<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户文件列表</title>
</head>
<body>

<h1> <span th:if="${session.user != null}" th:text="${session.user.username}" /> 用户</h1>
<h3>文件列表</h3>
<table border="1">
        <tr>
            <th>ID</th>
            <th>文件原始名称</th>
            <th>文件的新名称</th>
            <th>文件后缀</th>
            <th>存储路径</th>
            <th>文件大小</th>
            <th>类型</th>
            <th>是否是图片</th>
            <th>下载次数</th>
            <th>上传时间</th>
            <th>操作</th>
        </tr>
    <tr th:each="file,fileStat:${files}">
        <td><span th:text="${file.id}" /></td>
        <td><span th:text="${file.oldFileName}" /></td>
        <td><span th:text="${file.newFileName}" /></td>
        <td><span th:text="${file.ext}" /></td>
        <td><span th:text="${file.path}" /></td>
        <td><span th:text="${file.size}" /></td>
        <td><span th:text="${file.type}" /></td>
        <td>
            <img th:if="${file.isImg}=='是'" style="width: 100px;height: 40px" th:src="${#servletContext.contextPath}+${file.path}+'/'+${file.newFileName}" alt="">
            <span th:if="${file.isImg}!='是'" th:text="${file.isImg}"/>
        </td>
        <td><span th:text="${file.downCounts}" /></td>
        <td><span th:text="${file.uploadTime}" /></td>
        <td>
            <a th:href="@{/file/download(id=${file.id})}">下载</a>
            <a th:href="@{/file/download(id=${file.id}, openStyle='inline')}">在线打开</a>
            <a th:href="@{/file/delete(id=${file.id})}">删除</a>
        </td>
    </tr>
</table>
<hr>
<h3>上传文件</h3>
<form th:action="@{/file/upload}" method="post" enctype="multipart/form-data">
    <input type="file" name="aaa"> <input type="submit" value="上传文件">
</form>
</body>
</html>